package com.bindapp.model;

import android.content.Context;
import android.databinding.DataBindingUtil;
import android.support.v7.widget.LinearLayoutManager;
import android.view.LayoutInflater;
import android.view.View;

import com.bindapp.R;
import com.bindapp.adapter.SBGLAdapter;
import com.bindapp.databinding.ActivitySbglBinding;
import com.bindapp.listener.RecyclerItemClick;
import com.bindapp.widget.RVItemDecoration;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by apple on 2018/7/5.
 */

public class SBGLModel extends BaseModel {
    private ActivitySbglBinding binding;
    private SBGLAdapter adapter;
    private List<Object> datalist=new ArrayList<Object>();

    public SBGLModel(Context context){
        super(context);
        binding= DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.activity_sbgl,null,false);
        adapter=new SBGLAdapter(datalist,R.layout.item_sbgl,-1,new ItemClick());
        //binding.recycleview.setLayoutManager();
        testData();
        binding.recycleview.addItemDecoration(new RVItemDecoration(5));
        binding.recycleview.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
        binding.recycleview.setAdapter(adapter);
    }
    public void testData(){
        for(int i=0;i<3;i++){
            datalist.add(""+i);
        }
    }

    class ItemClick implements RecyclerItemClick {

        @Override
        public void onItemClick(int position) {

        }

        @Override
        public void onItemLongClick(int position) {

        }

        @Override
        public void onMoreClick(View view, int position) {

        }
    }

    @Override
    public ActivitySbglBinding getBinding() {
        return binding;
    }
}
